/**
 * ZHU framework. Copyright 2012-, all rights reserved.
 *
 * $Id: LoggerManager.java 33 2012-08-30 08:10:18Z zhuxiaopeng $
 * $Revision: 33 $
 * $Date: 2012-08-30 16:10:18 +0800 (四, 2012-08-30) $
 * $Author: zhuxiaopeng $
 */
package zhu.framework.util;

import java.util.logging.*;

import javax.enterprise.inject.*;
import javax.enterprise.inject.spi.*;

/**
 * <p>
 * </p>
 * 
 * @author $Author: zhuxiaopeng $
 * @version $Revision: 33 $ - $Date: 2012-08-30 16:10:18 +0800 (四, 2012-08-30) $
 */
public final class LoggerManager {
	static {
		instance = new LoggerManager();
	}

	private LoggerManager() {
	}

	/**
	 * Gets the singleton instance of this class.
	 * 
	 * @return The singleton instance of LoggerManager.
	 */
	public static LoggerManager getInstance() {
		return instance;
	}

	/**
	 * <p>
	 * Gets a <code>Logger</code> to use in specified class.
	 * </p>
	 * 
	 * @param clazz
	 *            The class which uses returned Logger.
	 * @return A <code>Logger</code> to use in specified class.
	 */
	public Logger getLogger(final Class<?> clazz) {
		return Logger.getLogger(clazz.getName());
	}

	@Produces
	public Logger getLogger(final InjectionPoint injectionPoint) {
		return Logger.getLogger(injectionPoint.getMember().getDeclaringClass().getName());
	}

	private static final LoggerManager instance;
}
